package com.itheima.reggie.common;

import java.util.ArrayList;
import java.util.List;

public class StringToLong {
    public static List<Long> stringToLong(String ids) {
        List<Long> idList = new ArrayList<>();
        if (ids.contains(",")) {    //ids有多个值的时候

            String[] id1 = ids.split(",");

            for (String s : id1) {
                Long id = Long.valueOf(s);
                idList.add(id);
            }

        } else   //ids为单个值
        {
            Long value = Long.valueOf(ids);
            idList.add(value);
        }
        return idList;
    }

}
